
package com.idealighter.game.recharge.manager;

import com.google.inject.Singleton;

import com.idealighter.game.dictionary.domain.RechargeItemDomain;
import com.idealighter.game.message.core.ResMessage;
import com.idealighter.game.recharge.convert.RechargeConvert;
import com.idealighter.game.recharge.dto.RechareAliPayResultDto;
import com.idealighter.game.recharge.dto.RechareApplePayResultDto;
import com.idealighter.game.recharge.dto.RechareWeChatPayResultDto;
import com.idealighter.game.recharge.dto.RechargeItemDto;
import com.idealighter.game.recharge.dto.RechargeRecordDto;
import com.idealighter.game.recharge.message.ResRechargeItemMsg;
import com.idealighter.game.recharge.message.ResRechargePayMsg;
import com.idealighter.game.recharge.message.ResRechargeRecordListMsg;
import com.idealighter.game.server.db.datadb.generate.domain.RechargeRecordDomain;

import java.util.List;

@Singleton
public class RechargeMsgMgr {


  /**
   * 发送充值item.
   * 
   * @param items 充值项列表.
   */
  public ResMessage resRechargeItemsMsg(List<RechargeItemDomain> items) {
    ResRechargeItemMsg msg = new ResRechargeItemMsg();

    List<RechargeItemDto> dtos = RechargeConvert.INSTANCE.toRechargeItemDtos(items);

    msg.setItems(dtos);

    return msg;
  }

  /**
   * 充值.
   * 
   * @Title sendRechargePay.
   * @author houdongsheng
   */
  public ResMessage sendRechargePay(int payType, RechareWeChatPayResultDto weChatPay,
      RechareAliPayResultDto aliPay, RechareApplePayResultDto applyPay) {
    ResRechargePayMsg msg = new ResRechargePayMsg();
    msg.setPayType(payType);
    msg.setWeChatPay(weChatPay);
    msg.setAliPay(aliPay);
    msg.setApplyPay(applyPay);

    return msg;
  }

  /**
   * 充值列表 .
   *
   * @author abin
   * @date 2018年5月23日 下午4:22:45
   * @param recordDomains 充值列表.
   * @return 消息.
   */
  public ResMessage resRechargeList(List<RechargeRecordDomain> recordDomains) {
    List<RechargeRecordDto> records = RechargeConvert.INSTANCE.toRechargeRecordDtos(recordDomains);
    ResRechargeRecordListMsg msg = new ResRechargeRecordListMsg();
    msg.setRecords(records);
    return msg;
  }
}
